package com.engine.salary.enums.salarybill;

import com.engine.salary.enums.BaseEnum;

import java.util.Arrays;

public enum SalarySendStatusEnum implements BaseEnum<Integer> {

    UNSEND(0, "未发放", 93286),
    ALREADYSEND(1, "已发放", 93212),
    WITHDRAW(2, "已撤回", 93287);

    private int value;

    private String defaultLabel;

    private int labelId;

    SalarySendStatusEnum(int value, String defaultLabel, int labelId) {
        this.value = value;
        this.defaultLabel = defaultLabel;
        this.labelId = labelId;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getDefaultLabel() {
        return defaultLabel;
    }

    @Override
    public Integer getLabelId() {
        return labelId;
    }

    public static String getDefaultLabelByValue(Integer value) {
        if (value == null) {
            return "";
        }
        SalarySendStatusEnum[] enumAry = SalarySendStatusEnum.values();
        for(int i = 0; i < Arrays.asList(enumAry).size(); i++){
            if (Integer.valueOf(enumAry[i].getValue()).equals(value)) {
                return enumAry[i].getDefaultLabel();
            }
        }
        return "";
    }

    public static String getNameByValue(Integer value) {
        if (value == null) {
            return "";
        }
        SalarySendStatusEnum[] enumAry = SalarySendStatusEnum.values();
        for(int i = 0; i < Arrays.asList(enumAry).size(); i++){
            if (Integer.valueOf(enumAry[i].getValue()).equals(value)) {
                return enumAry[i].name();
            }
        }
        return "";
    }
}
